package com.ebt.m.widget.image_chooser;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.view.ViewGroup;

import java.util.ArrayList;

/**
 * @author Damon
 */
public class ImagePagerPCAdapter extends FragmentStatePagerAdapter {

    private ArrayList<ImagePreviewBean> urls;

    public ImagePagerPCAdapter(FragmentManager fm, ArrayList<ImagePreviewBean> urls) {
        super(fm);
        this.urls = urls;
        if (this.urls == null) {
            this.urls = new ArrayList<ImagePreviewBean>();
        }
    }

    @Override
    public int getCount() {
        return urls.size();
    }

    @Override
    public Fragment getItem(int position) {
        return ImageChooserLocalImageDetail.newInstance(urls.get(position).url, true);
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        super.destroyItem(container, position, object);
    }

}
